-
Notifications
You must be signed in to change notification settings - Fork 42
Support multiple instances of a module. #451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support multiple instances of a module. #451
Conversation
|
Hi guys, this draft should be easy to review (hopefully). Let me know whether you are happy with this, then I will add a brief documentation. |
|
Hi @fschmenger and sorry for the delay on reviewing this one. I wanted to have a time slot where I could fully think about this one and experiment a bit before replying... At first, for sure this is quite a nice addition, easy to implement and potentially useful! Here are some thinkings/ideas/remarks that came to my mind while playing with this so we can discuss it a bit further:
<template v-for="(tbButton, index) in menuButtons" :key="index">
<v-list-item class="py-0">
<component
v-bind="tbButton"
:is="tbButton.type" :key="index"
/>
</v-list-item>
</template>it should be: <template v-for="(menuButton, index) in menuButtons" :key="index">
<v-list-item class="py-0">
<component
v-bind="menuButton"
:is="menuButton.type" :key="index"
/>
</v-list-item>
</template>
Once again I wrote something way too long. The idea is just to discuss thoroughly. Thanks again for this nice idea and addition! |
…lti instantiation.
…sts (functionality is already tested inside module core implementation).
9aff4ba to
c94e592
Compare
|
Thanks for the review @sronveaux. I rebased the branch on the current master. Everything mentioned above should be addressed now (fixing the typo should be part of a different PR). |
…nit tests to avoid warnings.
…e has been slightly altered to match WguAppTemplate.spec.js, redundant assertions have been removed.
…e stock components.
|
I finalized some missing parts in the documentation and unit tests. Happy if you can give it another review but take your time! |
sronveaux
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @fschmenger and thanks for the effort put on this "easy to review" one 😉
I really like how you structured and wrote the documentation here, it is crystal clear and gives some details for simple instantiation too which makes this also clearer for normal usage.
Except for some suggestions, which I let you choose whether they should be applied or not, it's approved and ready to merge!
| it('getModuleWinData(\'floating\') returns always an array', () => { | ||
| comp = createWrapper(); | ||
| vm = comp.vm; | ||
|
|
||
| // mock a window UI instance | ||
| const moduleData = vm.getModuleWinData('floating'); | ||
|
|
||
| expect(moduleData).to.be.an('array'); | ||
| }); | ||
|
|
||
| it('getModuleWinData(\'sidebar\') returns always an array', () => { | ||
| comp = createWrapper(); | ||
| vm = comp.vm; | ||
|
|
||
| // mock a window UI instance | ||
| const moduleData = vm.getModuleWinData('sidebar'); | ||
|
|
||
| expect(moduleData).to.be.an('array'); | ||
| }); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not directly related to this PR, but to align AppHeader tests and WguAppTemplate ones as stated in 20972ee perhaps those two could be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just looked into this. I think it`s too unrelated so I don't want to handle it here. Maybe we should open an issue and tackle some clean up tasks for unit tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't worry with this, I just proposed it so it would align with what you reorganized in 20972ee following the commit message:
Test structure has been slightly altered to match WguAppTemplate.spec.js, redundant assertions have been removed.
Depending on the point of view, those tests are redundant (as they are tested implicitly with the lengthof somewhere else) where some will argue unit tests should assert as few as possible and be "duplicated" to better document the code.
But I'm not sure it worths the follow-up here. Except if you see some other things to clean up in unit tests somewhere else...
|
Hi @sronveaux. Thanks again for the comprehensive review. |
|
Thanks @fschmenger for addressing this thoroughly and for this great feature ! Sure, the assertions were only far linked to this PR, it is always difficult to measure whether creating a separate PR for changing this worths the extra work... reason why I approved and only suggested. Thanks for taking it into account though. All the best, |
a7a1cc4 to
6b3d293
Compare
This PR adds a optional property
moduleTypeto the module configuration, to make it possible to instantiate the same module multiple times. This can be useful, i.e. when you have the same or similar application logic and just require different parametrization.To see an example, change the configuration of
sample-moduleinapp.conftoTo make it work, the line
moduleName="sample-module"(which was redundant and is now generically forwarded) must be removed from
SampleModule.vue:If you are using language files you must provide the title of the modules individually based on the instance name, e.g.